
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_Hans">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>GeoDjango &#8212; Django 3.2.6.dev 文档</title>
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../_static/language_data.js"></script>
    <link rel="index" title="索引" href="../../../genindex.html" />
    <link rel="search" title="搜索" href="../../../search.html" />
    <link rel="next" title="GeoDjango 教程" href="tutorial.html" />
    <link rel="prev" title="简单页面应用" href="../flatpages.html" />



 
<script src="../../../templatebuiltins.js"></script>
<script>
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../../templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);</script>

  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../../index.html">Django 3.2.6.dev 文档</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../../index.html">Home</a>  |
        <a title="Table of contents" href="../../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../../genindex.html">Index</a>  |
        <a title="Module index" href="../../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="../flatpages.html" title="简单页面应用">previous</a>
     |
    <a href="../../index.html" title="API 参考" accesskey="U">up</a>
   |
    <a href="tutorial.html" title="GeoDjango 教程">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-contrib-gis-index">
            
  <div class="section" id="s-module-django.contrib.gis">
<span id="s-geodjango"></span><span id="module-django.contrib.gis"></span><span id="geodjango"></span><h1>GeoDjango<a class="headerlink" href="#module-django.contrib.gis" title="永久链接至标题">¶</a></h1>
<p>GeoDjango 旨在成为一个世界级的地理网络框架。它的目标是使其尽可能容易地建立地理信息系统网络应用和利用空间数据的力量。</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">GeoDjango 教程</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#introduction">介绍</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#setting-up">设置</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#geographic-data">地理数据</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#geographic-models">地理模型</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#importing-spatial-data">导入空间数据</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#spatial-queries">空间查询</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial.html#putting-your-data-on-the-map">将你的数据放在地图上</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="install/index.html">GeoDjango 安装</a><ul>
<li class="toctree-l2"><a class="reference internal" href="install/index.html#overview">概况</a></li>
<li class="toctree-l2"><a class="reference internal" href="install/index.html#requirements">依赖项</a></li>
<li class="toctree-l2"><a class="reference internal" href="install/index.html#installation">安装</a></li>
<li class="toctree-l2"><a class="reference internal" href="install/index.html#troubleshooting">错误调试</a></li>
<li class="toctree-l2"><a class="reference internal" href="install/index.html#platform-specific-instructions">特定平台说明</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="model-api.html">GeoDjango Model API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="model-api.html#spatial-field-types">Spatial Field Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="model-api.html#spatial-field-options">Spatial Field Options</a></li>
<li class="toctree-l2"><a class="reference internal" href="model-api.html#geometry-field-options">Geometry Field Options</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="db-api.html">GeoDjango 数据库 API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="db-api.html#module-django.contrib.gis.db.backends">空间后端</a></li>
<li class="toctree-l2"><a class="reference internal" href="db-api.html#creating-and-saving-models-with-geometry-fields">Creating and Saving Models with Geometry Fields</a></li>
<li class="toctree-l2"><a class="reference internal" href="db-api.html#creating-and-saving-models-with-raster-fields">使用栅格字段创建和保存模型</a></li>
<li class="toctree-l2"><a class="reference internal" href="db-api.html#spatial-lookups">空间查找</a></li>
<li class="toctree-l2"><a class="reference internal" href="db-api.html#distance-queries">距离查询</a></li>
<li class="toctree-l2"><a class="reference internal" href="db-api.html#compatibility-tables">兼容性表</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="forms-api.html">GeoDjango 表单 API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="forms-api.html#field-arguments">字段参数</a></li>
<li class="toctree-l2"><a class="reference internal" href="forms-api.html#form-field-classes">表单字段类</a></li>
<li class="toctree-l2"><a class="reference internal" href="forms-api.html#module-django.contrib.gis.forms.widgets">表单部件</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="geoquerysets.html">GIS QuerySet API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="geoquerysets.html#spatial-lookups">空间查找</a></li>
<li class="toctree-l2"><a class="reference internal" href="geoquerysets.html#distance-lookups">距离查找</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="functions.html">地理数据库函数</a><ul>
<li class="toctree-l2"><a class="reference internal" href="functions.html#area"><code class="docutils literal notranslate"><span class="pre">Area</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#asgeojson"><code class="docutils literal notranslate"><span class="pre">AsGeoJSON</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#asgml"><code class="docutils literal notranslate"><span class="pre">AsGML</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#askml"><code class="docutils literal notranslate"><span class="pre">AsKML</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#assvg"><code class="docutils literal notranslate"><span class="pre">AsSVG</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#aswkb"><code class="docutils literal notranslate"><span class="pre">AsWKB</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#aswkt"><code class="docutils literal notranslate"><span class="pre">AsWKT</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#azimuth"><code class="docutils literal notranslate"><span class="pre">Azimuth</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#boundingcircle"><code class="docutils literal notranslate"><span class="pre">BoundingCircle</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#centroid"><code class="docutils literal notranslate"><span class="pre">Centroid</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#difference"><code class="docutils literal notranslate"><span class="pre">Difference</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#distance"><code class="docutils literal notranslate"><span class="pre">Distance</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#envelope"><code class="docutils literal notranslate"><span class="pre">Envelope</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#forcepolygoncw"><code class="docutils literal notranslate"><span class="pre">ForcePolygonCW</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#geohash"><code class="docutils literal notranslate"><span class="pre">GeoHash</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#geometrydistance"><code class="docutils literal notranslate"><span class="pre">GeometryDistance</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#intersection"><code class="docutils literal notranslate"><span class="pre">Intersection</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#isvalid"><code class="docutils literal notranslate"><span class="pre">IsValid</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#length"><code class="docutils literal notranslate"><span class="pre">Length</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#linelocatepoint"><code class="docutils literal notranslate"><span class="pre">LineLocatePoint</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#makevalid"><code class="docutils literal notranslate"><span class="pre">MakeValid</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#memsize"><code class="docutils literal notranslate"><span class="pre">MemSize</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#numgeometries"><code class="docutils literal notranslate"><span class="pre">NumGeometries</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#numpoints"><code class="docutils literal notranslate"><span class="pre">NumPoints</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#perimeter"><code class="docutils literal notranslate"><span class="pre">Perimeter</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#pointonsurface"><code class="docutils literal notranslate"><span class="pre">PointOnSurface</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#reverse"><code class="docutils literal notranslate"><span class="pre">Reverse</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#scale"><code class="docutils literal notranslate"><span class="pre">Scale</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#snaptogrid"><code class="docutils literal notranslate"><span class="pre">SnapToGrid</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#symdifference"><code class="docutils literal notranslate"><span class="pre">SymDifference</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#transform"><code class="docutils literal notranslate"><span class="pre">Transform</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#translate"><code class="docutils literal notranslate"><span class="pre">Translate</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html#union"><code class="docutils literal notranslate"><span class="pre">Union</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="measure.html">Measurement Objects</a><ul>
<li class="toctree-l2"><a class="reference internal" href="measure.html#example">例如</a></li>
<li class="toctree-l2"><a class="reference internal" href="measure.html#supported-units">Supported units</a></li>
<li class="toctree-l2"><a class="reference internal" href="measure.html#measurement-api">Measurement API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="geos.html">GEOS API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="geos.html#background">Background</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#tutorial">Tutorial</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#geometry-objects">Geometry Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#geometry-collections">Geometry Collections</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#prepared-geometries">Prepared Geometries</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#geometry-factories">Geometry Factories</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#i-o-objects">I/O Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#settings">配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="geos.html#exceptions">异常</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="gdal.html">GDAL API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#overview">概况</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#vector-data-source-objects">矢量数据源对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#ogr-geometries">OGR Geometries</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#coordinate-system-objects">Coordinate System Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#raster-data-objects">Raster Data Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#settings">配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdal.html#exceptions">异常</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="geoip2.html">用 GeoIP2 进行地理定位</a><ul>
<li class="toctree-l2"><a class="reference internal" href="geoip2.html#example">例如</a></li>
<li class="toctree-l2"><a class="reference internal" href="geoip2.html#api-reference">API 参考</a></li>
<li class="toctree-l2"><a class="reference internal" href="geoip2.html#methods">方法</a></li>
<li class="toctree-l2"><a class="reference internal" href="geoip2.html#settings">配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="geoip2.html#exceptions">异常</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="utils.html">GeoDjango 实用程序</a><ul>
<li class="toctree-l2"><a class="reference internal" href="layermapping.html"><code class="docutils literal notranslate"><span class="pre">LayerMapping</span></code> data import utility</a></li>
<li class="toctree-l2"><a class="reference internal" href="ogrinspect.html">OGR Inspection</a></li>
<li class="toctree-l2"><a class="reference internal" href="serializers.html"><code class="docutils literal notranslate"><span class="pre">GeoJSON</span></code> Serializer</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">GeoDjango Management Commands</a><ul>
<li class="toctree-l2"><a class="reference internal" href="commands.html#inspectdb"><code class="docutils literal notranslate"><span class="pre">inspectdb</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#ogrinspect"><code class="docutils literal notranslate"><span class="pre">ogrinspect</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="admin.html">GeoDjango 的管理站点</a><ul>
<li class="toctree-l2"><a class="reference internal" href="admin.html#geomodeladmin"><code class="docutils literal notranslate"><span class="pre">GeoModelAdmin</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="admin.html#osmgeoadmin"><code class="docutils literal notranslate"><span class="pre">OSMGeoAdmin</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="feeds.html">地理 Feed</a><ul>
<li class="toctree-l2"><a class="reference internal" href="feeds.html#example">例如</a></li>
<li class="toctree-l2"><a class="reference internal" href="feeds.html#api-reference">API 参考</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="sitemaps.html">Geographic Sitemaps</a><ul>
<li class="toctree-l2"><a class="reference internal" href="sitemaps.html#example">例如</a></li>
<li class="toctree-l2"><a class="reference internal" href="sitemaps.html#reference">参考</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing GeoDjango apps</a><ul>
<li class="toctree-l2"><a class="reference internal" href="testing.html#postgis">PostGIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html#geodjango-tests">GeoDjango tests</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="deployment.html">部署 GeoDjango</a></li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>上一个主题</h4>
  <p class="topless"><a href="../flatpages.html"
                        title="上一章">简单页面应用</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="tutorial.html"
                        title="下一章">GeoDjango 教程</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../../../_sources/ref/contrib/gis/index.txt"
            rel="nofollow">显示源代码</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>快速搜索</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="转向" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">7月 23, 2021</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="../flatpages.html" title="简单页面应用">previous</a>
     |
    <a href="../../index.html" title="API 参考" accesskey="U">up</a>
   |
    <a href="tutorial.html" title="GeoDjango 教程">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>